﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class TopicView : System.Web.UI.Page
{
    protected int Num=0;
    UserHelper u = new UserHelper();
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Num = Convert.ToInt32(Request.QueryString["ID"]);
        }
        catch
        {
            Response.Write("<script language='javascript'>window.location='About/error.html'</script>");
        }
        DataSet ds = u.GetTopicContent(Num);
        if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count>0)
        {
            Literal title = Master.FindControl("title") as Literal;
            title.Text = getTitle ()+ "-宣汉知名律师-宣汉律师";
            u.AddNum(Num);
            if (!IsPostBack)
            {
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
                Repeater2.DataSource = u.GetHotTopic();
                Repeater2.DataBind();
            }
        }
        else
        {
            Response.Write("<script language='javascript'>window.location='About/error.html'</script>");
            Num = 0;
        }
    }
    public string GetClass()
    {
        try
        {
            return u.GetTopicClass(Convert.ToInt32(u.GetTopicContent(Num).Tables[0].Rows[0]["TopicClass"].ToString()));
        }
        catch
        {
            return "null";
        }
    }
    public string backClassUrl()
    {
        try
        {
            return u.GetTopicContent(Num).Tables[0].Rows[0]["TopicClass"].ToString();
        }
        catch
        {
            return "0";
        }
    }
    public string getTitle()
    {
        try
        {
            return u.GetTopicContent(Num).Tables[0].Rows[0]["TopicTitle"].ToString();
        }
        catch
        {
            return "null";
        }
    }
}